package cn.pugle.base.encrypt;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacUtils;

/**
 * Created by tzp on 16-10-25.
 */
public class DigestTest {
    public static void main(String[] args) {
        System.out.println(DigestUtils.md5Hex("abc"));
        byte[] hmacSha1Bytes = HmacUtils.hmacSha1("04d0d988f3634f3f80147dc09a5bfd42",
                "http://adx.toutiao.com/adxbuyer/api/v1.0/creatives/put?dspid=12345&creative_num=3");
        String sig = Base64.encodeBase64URLSafeString(hmacSha1Bytes);
        System.out.println(sig);
    }
}
